package org.shiwen.week1;

public class Rect {
    /*
    * 定义了一个计算矩形面积的类
    * */
    double width;
    double height;
    double getArea() {
        return width * height; //返回一个值，表示矩形的面积
    }
}

class TestRect {
    public static void main(String[] args) {
        Rect r1;
        r1 = new Rect();
        r1.width = 10;
        r1.height = 20;
        double area = r1.getArea();
        System.out.println("矩形的面积：" + area);
    }
}
